use log::info;
use quote::quote;

macro_rules! router {
    (GET $path:literal => $handler:expr) => {
        info!("GET route: {}", $path);
        $handler();
    };
    (POST $path:literal => $handler:expr) => {
        info!("POST route: {}", $path);
        $handler();
    };
    ($method:ident $path:literal => $handler:expr) => {
        info!("{} route: {}", stringify!($method), $path);
    };
}

#[test]
fn main() {
    router!(GET "/api/users" => get_users);
    router!(POST "/api/users" => create_user);
    let vec2 = vec![1, 2];
    let vec3 = vec![1, 2, 3];

    // if let Some(tuple) = vec_to_tuple!(vec2) {
    //     info!("{:?}", tuple); // (1, 2)
    // }
}

fn get_users() {
    info!("get users");
}

fn create_user() {
    info!("create user");

}

macro_rules! vec_to_tuple {
    ($vec:expr) => {
        {
            let vec = $vec;
            match vec.len() {
                2 => Some((vec[0], vec[1])),
                3 => Some((vec[0], vec[1], vec[2])),
                4 => Some((vec[0], vec[1], vec[2], vec[3])),
                _ => None,
            }
        }
    };
}

